<!DOCTYPE html>
<html >
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>事件处理</title>
</head>
<body>
    <button>点我</button>
    
</body>
<script>
    let btn = document.querySelector('button');
    btn.onclick = function(){
        alert('这是通过JS对象的属性，为元素添加事件处理1');
    }


</script>
</html>